﻿jQuery(function($) {
	$('input.auto').blur(function(){
		var convertInput = '';
		if(this.name != 'decimal' && this.value != '' && this.id != 'ii1' & this.id.charAt(0) != 'n'){
			var	strip = 'db' + this.id.charAt(2);
			var format = 'ni' + this.id.charAt(2);
			convertInput = $.fn.autoNumeric.Strip(this.id);
			$('#'+strip).val(convertInput);
			$('#'+format).val($.fn.autoNumeric.Format(format, convertInput));
		}
		if((this.id == 'ii1' || this.id == 'dpb') && this.value != '' && this.id.charAt(0) != 'n'){
			convertInput = $.fn.autoNumeric.Strip('ii1');
			var i = 1;
			for (i=1; i <= 9; i++){
				document.getElementById('ni'+i).value = $.fn.autoNumeric.Format('ni'+i, convertInput);
			}	
		}
	});	
});